package com.imooc.course5

/*
 * @Author Wangjin
 * @Date 2019-02-28
 * @Email wangjin4901@vip.qq.com
 */

object SimpleObjectApp {
  def main(args: Array[String]): Unit = {
    val person = new People()
    person.name = "Messi"
//    person.age = 10
    println(person.name + ".." + person.age)
    println("invoke eat method:" + person.eat)
    person.watchFootball("Barcelona")
    person.printInfo()
//    println(person.gender)
  }
}

class People {
  // 定义属性
  var name:String = _
  val age = 10

  // 定义方法
  def eat ():String = {
    name + " eat..."
  }

  private [this] val gender = "male"


  def printInfo(): Unit = {
    println("gender:" + gender)
  }

  def watchFootball (teamName: String): Unit ={
    println(name + " is watching match of " + teamName)
  }

}
